package com.xue.action${mod};



import java.util.Map;
import java.util.List;
import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

import ${basePackage}.pojo.${className};
import ${basePackage}.service${mod}.${className}Service;


/**
 * Description: ${className} <br/>
 * Date: ${date} <br/>
 * 
 * @author xuejianxinokok@163.com
 */
@RequestMapping(value = ${className}Controller.PATH)
@RestController("${className}Controller")
@Tag(name = "${className}Controller")
public class ${className}Controller{
    private static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(${className}Controller.class);
    public static final String PATH = "${modPath}${className?lower_case}";
	
    @Autowired
	private ${className}Service service;
	/*分页查询*/
	@Operation(summary = "分页查询列表", description = "分页查询列表")
	@PostMapping("listPage")
	public Page<${className}> listPage(@RequestBody Map<String, Object> ps) {
		return service.queryByPage(ps);
	}
	/*按id查询*/
	@Operation(summary = "根据id 获取", description = "根据id 获取")
	@PostMapping("getById")
	public ${className} getById(@RequestBody ${className} ps) {
		${className} vo = service.queryById(ps.getId()).get();
		return vo;
	}
	
    /*保存*/
	@Operation(summary = "保存", description = "保存")
	@PostMapping("save")
	public Long save(@RequestBody ${className} vo) {
		service.save(vo);
		return vo.getId();
	}
    /*更新*/
	@PostMapping(value = "update", name = "更新")
	public Long update(@RequestBody ${className} vo) {
		service.update(vo);
		return vo.getId();
	}
   
	
	/* 删除 */
	@PostMapping(value = "deleteByIds", name = "删除")
	public Integer deleteByIds(@RequestBody List<Long> ids) {
		service.deleteByIds(ids);
		return ids.size();
	}

}